package models;

import play.*;
import play.data.validation.Email;
import play.data.validation.Required;
import play.db.jpa.*;

import javax.persistence.*;

import net.sf.oval.constraint.MinLength;

import java.util.*;

/**
 * 用户
 * @author justin
 *
 */
@Entity
public class User extends BaseEntity {
	/*用户名*/
	@Required
	public String username;
	
	/*密码*/
	@Required
	public String password;
	
	/*安全问题*/
	@Required
	public String question;
	
	/*安全问题答案*/
	@Required
	public String answer;
	
	/*用户真实姓名*/
	@Required
	public String realname;
	
	/*性别*/
	public String sex;
	
	/*生日*/
	public Date birthday;
	
	/*省*/
	public String province;
	
	/*市*/
	public String city;
	
	/*销售模式*/
	public String salesmode;
	
	/*邮政编码*/
	public String zipcode;
	
	/*收货地址*/
	public String deliveryAddress;
	
	/*联系电话*/
	public String phoneNo;
	
	/*QQ*/
	public String qqNo;
	
	/*MSN*/
	public String msnNo;
	
	/*E-mail*/
	@Required
	@Email
	public String email;
	
	/*如何得知本商城*/
	public String howtoknow;
	
	/*身份证照片*/
	@Required
	@OneToOne(cascade=CascadeType.ALL)
	public Attachment idphoto;
	
	public boolean authentication;
	
	/*用户组*/
	@ManyToMany
	public List<UserGroup> groups;
	
	@Transient
	public UserGroup group;
	
}

